﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SphereTranslateMgr : MonoBehaviour {
    public static bool m_bIsSphereDrop = false;  //小球是否开始下落，是否有小球到达指定位置， 其他小球的MyUpdate是否继续运行    
    //public static float m_fLength;
    void Update ()
    {
        if (Game1.isSong)
        {
            if (m_bIsSphereDrop)
            {
                int n = Game1.SphereList.Count;
                if (0 != n)
                {
                    List<Transform> list = Game1.SphereList;
                    for (int i = 0; i < n; i++)
                    {
                        list[i].gameObject.GetOrAddComponent<SphereTranslate>().MyUpdate();
                    }
                }
            }
            else
            {
                Game1.SphereList[0].GetComponent<SphereTranslate>().ChangeImage(10);
            }
        }     
    }
    public static bool StopDrop(GameObject obj)
    {
        SphereTranslate sphereTranslate = obj.GetComponent<SphereTranslate>();
        sphereTranslate.m_fNowTime = 10;
        sphereTranslate.m_b_ = true;
        //m_fLength = ((Game1.SphereList[0]) as RectTransform).sizeDelta.x;
        Game1.SphereList[0].GetComponent<SphereTranslate>().m_bChange = true;
        return m_bIsSphereDrop = false;
    }
    public static bool StartDrop()
    {        
        return m_bIsSphereDrop = true;       
    }
}
